<html>
<head><meta charset="utf-8"><title>Async keyword · t-libs/wg-allocators · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/index.html">t-libs/wg-allocators</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Async.20keyword.html">Async keyword</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223008382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Async%20keyword/near/223008382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arthur <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Async.20keyword.html#223008382">(Jan 16 2021 at 21:51)</a>:</h4>
<p>Just wondering, if there is already an effort to have async keyword work with the allocation_api?<br>
afaik async keyword boxes the state machine, and I'd love to specify a custom allocation for those.</p>



<a name="223008466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Async%20keyword/near/223008466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthias247 <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Async.20keyword.html#223008466">(Jan 16 2021 at 21:53)</a>:</h4>
<blockquote>
<p>afaik async keyword boxes the state machine</p>
</blockquote>
<p>That's wrong. An <code>async fn</code> will return an unboxed <code>Future</code>. If you want to box it, you can do it yourself (e.g. using <code>Box::pin</code>). And while doing that, you can use a custom allocator. But futures are designed to avoid allocations for most scenarios</p>



<a name="223008971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Async%20keyword/near/223008971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arthur <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Async.20keyword.html#223008971">(Jan 16 2021 at 22:01)</a>:</h4>
<p>interesting, so my runtime does that for me I guess, and I was looking at the wrong place.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>